<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="${ctx}/static/h5/css/public/bootstrap.min.css" type="text/css">
    <link rel="stylesheet" href="${ctx}/static/h5/css/personal/sugestion.css"/>
    <title>意见反馈</title>
    <script src="${ctx}/static/h5/js/public/jquery-2.2.3.min.js"></script>
    <script src="${ctx}/static/h5/js/public/bootstrap.min.js"></script>
    <script>
        $(document).ready(function() {
            $("#submit").on("click",function(){
                var mobile = $("#mobile").val();
                var message = $("#message").val();
                var userId=localStorage.getItem("userId");
                var reg = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
                if(message == "" || message == null){
                    alert("请输入反馈内容");
                    return;
                }
                if (!reg.test(mobile)) {
                    alert("号码有误~");
                    return;
                }

                $.ajax({
                    type:'get',
                    url:'/h5/feedback/send',
                    data:{
                        'userId':'1',
                        'message':message,
                        'mobile':mobile
                    },
                    success:function(data){
                        console.log(data);
                        if(data.resCode == 0){
                            alert("提交失败");
                            return;
                        }
                        if(data.resCode == 1){
                            alert("提交成功");
                            location.href='${ctx}/h5/user/mzone?userId='+userId;
                        }
                    }

                })
            })
        })
    </script>
</head>
<body>
<div id="sugestion">
    <header>
        <a href="javascript:;" onclick="window.history.back()" class="go-back">
            <i class="fa fa-angle-left" aria-hidden="true"></i>
            <span>返回</span>
        </a>
        <h4>意见反馈</h4>
    </header>
    <section class="sugestion-contnet">
        <div class="bs-example bs-example-form" role="form">
            <textarea rows="5" id="message" placeholder="请写下你的宝贵意见！"></textarea>
            <p>请留下你的联系方式</p>
            <div class="input-group">
                <input type="text" id="mobile" class="form-control" placeholder="请输入你的手机号码（选填）">
            </div>
            <button id="submit" class="btn btn-success" onclick="sub()">提交</button>
        </div>
    </section>
</div>
</body>
<script>
    var cont = document.getElementById('message')
    var tel = document.getElementById('mobile')
    cont.onfocus =function(){
        this.style.outline = "none"
    }
    tel.onfocus =function(){
        this.style.outline = "none"
        this.style.boxShadow = "none"
    }
    function sub(){
        this.style.outline = "none"

    }
</script>
</html>